package com.xxxx.server.controller;


import com.xxxx.server.pojo.Department;
import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.service.IDepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhoubin
 */
@Api("基础信息")
@RestController
@RequestMapping("/system/basic/department")
public class DepartmentController {

	@Autowired
	private IDepartmentService departmentService;



	@ApiOperation(value = "查找所有部门的数据")
	@GetMapping("/")
	public List<Department> findAllDepartment(){
		return departmentService.findAllDepartment();
	}
	@ApiOperation(value = "添加部门")
	@PostMapping("/")
	public RespBean insertDepartment(@RequestBody Department department){
		return departmentService.insertDepartment(department);

	}
	@ApiOperation(value = "删除部门")
	@DeleteMapping("/{id}")
	public RespBean deleteDepartment(@PathVariable("id") Integer id){
		return departmentService.deleteDepartment(id);

	}


}
